package com.bawei.day0129.viewmodel;

import android.app.Application;

import androidx.annotation.NonNull;
import androidx.lifecycle.MutableLiveData;

import com.bawei.day0129.Bean.YzmBean;
import com.bawei.day0129.Bean.ZhuCheBean;
import com.bawei.day0129.base.BaseViewModel;
import com.bawei.day0129.utils.HttpUtils;

import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.functions.Consumer;
import io.reactivex.schedulers.Schedulers;

public class ZhuCheViewModel extends BaseViewModel {
    public ZhuCheViewModel(@NonNull Application application) {
        super(application);
    }
    private MutableLiveData<ZhuCheBean> getZhuChe=new MutableLiveData<>();

    public MutableLiveData<ZhuCheBean> getGetZhuChe(String a, String b, String c, String d, String e) {
        HttpUtils.getHttpUtils().getApisices().getZhuChe(a, b, c, d, e)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new Consumer<ZhuCheBean>() {
                    @Override
                    public void accept(ZhuCheBean zhuCheBean) throws Exception {
                        getZhuChe.postValue(zhuCheBean);
                    }
                });
        return getZhuChe;
    }
    private MutableLiveData<YzmBean> getYzm=new MutableLiveData<>();

    public MutableLiveData<YzmBean> getGetYzm(String a) {
        HttpUtils.getHttpUtils().getApisices().getYzm(a)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new Consumer<YzmBean>() {
                    @Override
                    public void accept(YzmBean yzmBean) throws Exception {
                        getYzm.postValue(yzmBean);
                    }
                });
        return getYzm;
    }
}
